package hcn.protocol.brandnew.zhenliao.jiancha;

import lombok.Data;
import javax.xml.bind.annotation.*;
import java.util.List;
import hcn.protocol.brandnew.BaseRequest;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import ctd.util.xml.jaxb.DateTimeAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;


/**
 * 检查申请单更新 - ODS_03070009
 *
 * @author enjoyLife
 */
@Data
@XmlRootElement(name = "MsgBody")
@XmlAccessorType(XmlAccessType.FIELD)
public class UpdateApplyFormRequest extends BaseRequest {

    /**
     * 患者基本信息
     */
    @XmlElement(name = "Patient")
    private Patient patient;
    /**
     * 就诊摘要
     */
    @XmlElement(name = "Visit")
    private Visit visit;
    /**
     * 检查状态信息
     */
    @XmlElement(name = "ExamStatusInfo")
    private ExamStatusInfo examStatusInfo;

    @Data
    @XmlAccessorType(XmlAccessType.FIELD)
    public static class Patient {

        /**
         * 业务系统患者档案ID
         */
        @XmlElement(name = "SourcePatientId")
        private String sourcePatientId;
        /**
         * 患者姓名
         */
        @XmlElement(name = "Name")
        private String name;
        /**
         * 域ID
         */
        @XmlElement(name = "DomainId")
        private String domainId;
        /**
         * 建档机构代码
         */
        @XmlElement(name = "AuthorOrganization")
        private String authorOrganization;
        /**
         * 业务系统患者档案类型
         */
        @XmlElement(name = "SourcePatientIdType")
        private String sourcePatientIdType;
    }

    @Data
    @XmlAccessorType(XmlAccessType.FIELD)
    public static class Visit {

        /**
         * 就诊流水号
         */
        @XmlElement(name = "VisitId")
        private String visitId;
        /**
         * 患者类型代码
         */
        @XmlElement(name = "PatientType")
        private String patientType;
        /**
         * 门（急）诊号
         */
        @XmlElement(name = "ClinicId")
        private String clinicId;
        /**
         * 住院号
         */
        @XmlElement(name = "HospizationId")
        private String hospizationId;
        /**
         * 就诊次数
         */
        @XmlElement(name = "VisitTimes")
        private Short visitTimes;
    }

    @Data
    @XmlAccessorType(XmlAccessType.FIELD)
    public static class Item {

        /**
         * 检查项目代码
         */
        @XmlElement(name = "ItemCode")
        private String itemCode;
        /**
         * 项目费用
         */
        @XmlElement(name = "ItemCost")
        private String itemCost;
        /**
         * 发票号码(申请单)
         */
        @XmlElement(name = "InvoiceNo")
        private String invoiceNo;
        /**
         * 检查状态编码
         */
        @XmlElement(name = "ExamStatusCode")
        private String examStatusCode;
        /**
         * 检查状态名称
         */
        @XmlElement(name = "ExamStatusName")
        private String examStatusName;
    }

    @Data
    @XmlAccessorType(XmlAccessType.FIELD)
    public static class ExamStatusInfo {

        /**
         * 电子申请单编号
         */
        @XmlElement(name = "RequestId")
        private String requestId;
        /**
         * 就诊机构代码/开单机构代码
         */
        @XmlElement(name = "VisitOrganization")
        private String visitOrganization;
        /**
         * 检查大项列表
         */
        @XmlElementWrapper(name = "ItemList")
        @XmlElement(name = "Item")
        private List<Item> itemList;
        /**
         * 操作日期
         */
        @XmlElement(name = "OperatingDateTime")
        @XmlJavaTypeAdapter(DateTimeAdapter.class)
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
        private Date operatingDateTime;
        /**
         * 操作工号
         */
        @XmlElement(name = "OperatingNumber")
        private String operatingNumber;
        /**
         * 操作人姓名
         */
        @XmlElement(name = "OperatingName")
        private String operatingName;
        /**
         * 执行科室代码
         */
        @XmlElement(name = "ExecutiveDeptCode")
        private String executiveDeptCode;
        /**
         * 执行科室名称
         */
        @XmlElement(name = "ExecutiveDeptName")
        private String executiveDeptName;
        /**
         * 病床号
         */
        @XmlElement(name = "SickbedId")
        private String sickbedId;
        /**
         * 病房号
         */
        @XmlElement(name = "SickRoomId")
        private String sickRoomId;
        /**
         * 科室代码
         */
        @XmlElement(name = "DeptCode")
        private String deptCode;
        /**
         * 科室名称
         */
        @XmlElement(name = "DeptName")
        private String deptName;
        /**
         * 病区代码
         */
        @XmlElement(name = "WardAreaCode")
        private String wardAreaCode;
        /**
         * 病区名称
         */
        @XmlElement(name = "WardAreaName")
        private String wardAreaName;
        /**
         * 病床编码
         */
        @XmlElement(name = "SickbedNo")
        private String sickbedNo;
        /**
         * 病房编号
         */
        @XmlElement(name = "SickRoomNo")
        private String sickRoomNo;
    }

}
